import { Link } from 'umi';
import { stringify } from 'querystring';
export default function RouterJump() {
  const a = 'b';

  return (
    <div>
      <div>
        <Link to={{ pathname: '/home', state: { a: 'b', a1: 'b1' } }}>
          1.state传参
        </Link>
      </div>
      <div>
        <Link to={{ pathname: '/home', query: { a: 'b', a1: 'b1' } }}>
          2.query传参
        </Link>
      </div>
      <div>
        {/* 动态路由是'/home/:a' */}
        <Link to={{ pathname: `/home/${a}` }}>3.params传参</Link>
      </div>
      <div>
        <Link
          to={{ pathname: '/home', search: stringify({ a: 'b', a1: 'b1' }) }}
        >
          4.search传参1
        </Link>
        或
        <Link to={{ pathname: '/home', search: '?a=b&a1=b1' }}>
          search传参2
        </Link>
        或<Link to="/home?a=b&a1=b1">search传参3</Link>
      </div>
    </div>
  );
}
